package org.jeecg.modules.tls.csmg.csquestionsandanswers.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.modules.tls.csmg.csquestionsandanswers.entity.CsQuestionsandanswers;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.tls.csmg.viewmodel.qa.AnswerListVM;
import org.jeecg.modules.tls.csmg.viewmodel.qa.QuestionListVM;

import java.util.List;

/**
 * @Description: cs_questionsandanswers
 * @Author: jeecg-boot
 * @Date:   2022-08-05
 * @Version: V1.0
 */
public interface ICsQuestionsandanswersService extends IService<CsQuestionsandanswers> {

    /*
     * @description:添加用户输入的问答，如果pid为0则为问，如果pid为问的id则为答
     * @author: GGB 
     * @date: 2022/9/3 15:18
     * @param: userId 用户id
     * @param: courseId 课程id
     * @param: pid 父id
     * @param: content 问答内容
     * @return: Boolean
     **/
    Boolean addQA(String userId,String courseId,String pid,String content);

    /*
     * @description: 删除问答。如果pid为0，则还需要删除所有的子问答
     * @author: GGB
     * @date: 2022/9/3 15:36
     * @param: id
     * @return: Boolean
     **/
    Boolean deleteQA(String id);

    /*
     * @description: 问题列表的分页
     * @author: GGB
     * @date: 2022/9/3 15:50
     * @param: courseId
     * @param: pageIndex
     * @param: pageSize
     * @return: IPage<QuestionListVM>
     **/
    IPage<QuestionListVM> getQuestionPage(String courseId,Integer pageIndex,Integer pageSize);

    /*
     * @description: 设置满意回答
     * @author: GGB
     * @date: 2022/9/3 16:17
     * @param: pid 问题id
     * @param: id 回复id
     * @return: Boolean
     **/
    Boolean setSatisfied(String pid,String id);

    /*
     * @description: 取消满意回答
     * @author: GGB
     * @date: 2022/9/3 16:26
     * @param: pid
     * @return: Boolean
     **/
    Boolean cancelSatisfied(String pid);

    /*
     * @description: 获取该问题下的回复内容
     * @author: GGB
     * @date: 2022/9/3 16:58
     * @param: id
     * @param: userId
     * @return: AnswerListVM
     **/
    AnswerListVM getAnswerList(String id,String userId);
}
